Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
React.js "let" v.s "const" v.s "var" v.s "state"

I'm learning React.js recently,

and I have some questions,

  1. As we know setState is asynchrony, if we don't use js framework, we will use let const or var to setting variable, it's synchrony, but why we should much more use state instead of let const var to setting variable in React.js?

  2. Some scenario I use state but it cannot work very well to my WebApp, so that I try to use let to set my variable, and it can work very well, but I think if I use let rather than state, is it not a good idea because I wasted React.js advantage?

thank you for your help :>

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

Simply, in most cases we use state if we will use it in the UI ( in the JSX mockups ), as when it updates with setState the UI updates, this doesn't happen with normal javascript variables as it re-initializes when the component updates.

That's besides that other hooks, just updates regard to stateful dependencies only, like useEffect, useMemo, useCallback.

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda